<template>
	<view>
		<u-navbar :border-bottom="false" title="APP版本" :title-size="36" :title-bold="true" :title-color="textColor"></u-navbar>
		<!-- <login-bk style="margin-top: 165rpx;" /> -->
		
		<!-- #ifdef APP-PLUS -->
		<view style="text-align: center;">更新日志({{ version }})</view>
		<view v-for="(item,index) in upgradeLog" :key="index" style="text-align: center;">
			{{index+1}}:{{item}}
		</view>
		<!-- #endif -->
		<view class="version">
			<!-- #ifdef APP-PLUS -->
				<view type="default" class="update-btn" @click="goUpdate">检查更新</view>
				<!-- #endif -->
			<view style="margin-bottom: 20rpx;">版本号：{{ version }}</view>
			<view class="">
					<view style="text-align: center;">COPYRIGHT © {{$u.date(new Date(), 'yyyy')}}</view>
					<view style="text-align: center;">北京闪酿科技有限有限公司.</view>
					<view style="text-align: center;">ALL RIGHTS RESERVED</view>
			</view>
			
		</view>
		<!-- #ifdef APP-PLUS -->
		<!-- <check-update :key="isUpdate" :dadType="'isVersion'"></check-update> -->
		<!-- #endif -->
	</view>
</template>

<script>
	import CheckUpdate from '@/components/check-update/index.vue'
	// import LoginBk from '@/pages/login/components/loginBk.vue'
	export default {
		components: {CheckUpdate },
		data() {
			return {
				version: '1.0.0',
				upgradeLog:[],
				isUpdate:'isUpdate'
			}
		},
		onLoad() {
			
			// #ifndef H5
				let that = this;
				plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
					console.log(widgetInfo);
					that.version = widgetInfo.version
				})
				this.getLogs()
			// #endif
			
		},
		methods:{
				
			goUpdate(){
				uni.showLoading({
					title: '检查更新',
					mask: false
				});
				this.isUpdate = this.isUpdate==='isUpdate'?'isUpdate2':'isUpdate';
			},
			async getLogs(){
				// api/AppPackage/GetAppPackage?name=1.0.1
				let res = await this.$http.get('api/AppPackage/GetAppPackage',{ name: this.version });
				console.log(res);
				if(res){
					this.upgradeLog = JSON.parse(res.upgradeLog)
				}
			}
		}
	}
</script>
<style>
	page {
		background-color: #FFFFFF;
	}
</style>
<style lang="scss" scoped>
	.version {
		position: fixed;
		width: 100%;
		bottom: 180rpx;
		text-align: center;
	}
	.update-btn{
		box-sizing: border-box;
		padding: 8rpx 10rpx;
		border: 1px solid #c1c1c1;
		width: 200rpx;
		margin: 0 auto;
		margin-bottom: 20rpx;
	}
</style>
